package com.rt.easyjava.common.utils.random;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class RandomRules {
    public static final JSONArray rule1;

    static {
        rule1 = genRule();
    }

    public static JSONArray genRule() {
        JSONArray rule1 = new JSONArray();
        RandomRules.addTimeJsonObject(rule1, 0, 1,5);
        RandomRules.addTimeJsonObject(rule1, 1, 1,5);
        RandomRules.addTimeJsonObject(rule1, 2, 1,5);
        RandomRules.addTimeJsonObject(rule1, 3, 1,5);
        RandomRules.addTimeJsonObject(rule1, 4, 1,5);
        RandomRules.addTimeJsonObject(rule1, 5, 1,5);
        RandomRules.addTimeJsonObject(rule1, 6, 10,20);
        RandomRules.addTimeJsonObject(rule1, 7, 20,30);
        RandomRules.addTimeJsonObject(rule1, 8, 100,150);
        RandomRules.addTimeJsonObject(rule1, 9, 500,550);
        RandomRules.addTimeJsonObject(rule1, 10, 600,660);
        RandomRules.addTimeJsonObject(rule1, 11, 700,770);
        RandomRules.addTimeJsonObject(rule1, 12, 800,880);
        RandomRules.addTimeJsonObject(rule1, 13, 900,990);
        RandomRules.addTimeJsonObject(rule1, 14, 800,880);
        RandomRules.addTimeJsonObject(rule1, 15, 800,900);
        RandomRules.addTimeJsonObject(rule1, 16, 900,990);
        RandomRules.addTimeJsonObject(rule1, 17, 700,770);
        RandomRules.addTimeJsonObject(rule1, 18, 800,880);
        RandomRules.addTimeJsonObject(rule1, 19, 400,480);
        RandomRules.addTimeJsonObject(rule1, 20, 200,250);
        RandomRules.addTimeJsonObject(rule1, 21, 700,100);
        RandomRules.addTimeJsonObject(rule1, 22, 5,10);
        RandomRules.addTimeJsonObject(rule1, 23, 1,5);
        return rule1;
    }

    public static void addTimeJsonObject(JSONArray rule, int hour, int min, int max) {
        JSONObject jo = new JSONObject();
        jo.put("time", hour);
        jo.put("min", min);
        jo.put("max", max);
        rule.add(jo);
    }
}
